package com.zret.oasys.operation.attendance;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.zret.oasys.json.entity.MsgJson;

public class UpdateAttendanceType implements AttendanceServletOperation {

	@Override
	public void doOperation(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		//设置请求编码
		request.setCharacterEncoding("utf-8");
		//设置响应编码
		response.setContentType("application/json;charset=utf-8");
		//获取输出流
		PrintWriter out = response.getWriter();
		//获取参数
		String serialnum = request.getParameter("serialnum3");
		String attencetype = request.getParameter("attencetype3");
		//调用业务层
		boolean flag = attendanceService.updateAttendanceType(serialnum, attencetype);
		//创建Gson对象
		
		Gson gson=new Gson();
		MsgJson msgJson=new MsgJson();
		
		
		if (flag) {
			msgJson.setMsg("修改成功");
			String msgjsonstr = gson.toJson(msgJson);
			out.print(msgjsonstr);
		}else {
			
			msgJson.setMsg("修改失败");
			String msgjsonstr = gson.toJson(msgJson);
			out.print(msgjsonstr);
		}
		//关闭流
		out.close();
		
		
	
		

	}

}
